class Solution(object):
    def canJump(self, nums:list[int]) -> bool:
        targetIndex = len(nums) - 1
        if len(nums) > 1:
            for i in range(len(nums) - 2, -1, -1):
                if nums[i] >= targetIndex - i:
                    targetIndex = i

        return targetIndex == 0

if __name__ == '__main__':
    s = Solution()
    nums = [2,3,1,1,4]
    print(s.canJump(nums))